package com.bestdreamer.thread_volatile;

public class Demo1RunThread extends Thread{

    private volatile boolean isRunning = true;

    public boolean isRunning(){
        return isRunning;
    }

    public void setRunning(boolean isRunning){
        this.isRunning = isRunning;
    }

    @Override
    public void run() {
        System.out.println("进入 run 了");
        while (isRunning == true){
        }
        System.out.println("线程被停止了！");
    }
}
